package com.google.code.jmarias.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Ondrej Michal
 */
public class NewPlayer {

    private AbstractUser client;

    private List<Card> hand = new ArrayList<Card>();

    public NewPlayer(AbstractUser client) {
        this.client = client;
    }

    public void addToHand(Card card) {
        hand.add(card);
    }

    @Override
    public String toString() {
        return "Hrac " + client + " ma v ruce tyto karty: " + hand;
    }

    // equals je potreba v NewAbstractPhase

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final NewPlayer other = (NewPlayer) obj;
        if (this.client != other.client && (this.client == null || !this.client.equals(other.client))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.client != null ? this.client.hashCode() : 0);
        return hash;
    }

    // @TODO rename
    public AbstractUser getClient() {
        return client;
    }

    public void setClient(AbstractUser client) {
        this.client = client;
    }

    public List<Card> getHand() {
        return hand;
    }

}
